/**
  ******************************************************************************
  * @file           : main.c
  * @brief          : Main program body
  ******************************************************************************
  * @attention
  *
  ******************************************************************************
  */

/* Includes ------------------------------------------------------------------*/
#include "bsp.h"
#include "tskcfg.h"
#include "gv.h"
#include <string.h>

/* TODO: 未添加看门狗  若添加看门狗 只在vDeamon_Task任务中喂狗 */

const Sys_VersionStru sys_version = 
{
  .sn = "0123456789",
  .sv = "1.21",
  .pv = "1.00",
  .uv = "1.04",
  .bd = __DATE__" "__TIME__,
};

GlobalVariablesStru gv;

/**
  * @brief  The application entry point.
  * @retval int
  */
int main(void)
{
  system_init();
  
  memset(&gv, 0, sizeof(gv));
  strncpy((char *)gv.ir.meas_ca.str_sn, sys_version.sn, sizeof(gv.ir.meas_ca.str_sn));
  strncpy((char *)gv.ir.meas_ca.str_sv, sys_version.sv, sizeof(gv.ir.meas_ca.str_sv));
  strncpy((char *)gv.ir.meas_ca.str_pv, sys_version.pv, sizeof(gv.ir.meas_ca.str_pv));
  strncpy((char *)gv.ir.meas_ca.str_uv, sys_version.uv, sizeof(gv.ir.meas_ca.str_uv));
  strncpy((char *)gv.ir.meas_ca.str_bd, sys_version.bd, sizeof(gv.ir.meas_ca.str_bd));
  
  printf("ics-12fa run build date:%s\r\n", sys_version.bd);
  
  APP_CreateTask();

  /* Start scheduler */
  vTaskStartScheduler();

  /* We should never get here as control is now taken by the scheduler */
  while (1)
  {
  }
}

#ifdef  USE_FULL_ASSERT
/**
  * @brief  Reports the name of the source file and the source line number
  *         where the assert_param error has occurred.
  * @param  file: pointer to the source file name
  * @param  line: assert_param error line source number
  * @retval None
  */
void assert_failed(uint8_t *file, uint32_t line)
{
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
}
#endif /* USE_FULL_ASSERT */
